#include <iostream>
using std::cin;
using std::cout;
using std::endl;

int main()
{
	int stars;
	int column;
	int row = 1;

	cout << "Enter Number of Stars: ";
	cin >> stars;

	if(stars < 1)
	{
		stars = 1;
		cout << "Invalid Input for Stars\nUsing default value 1\n";
	}
	else if(stars > 20)
	{
		stars = 20;
		cout << "Invalid Input for Stars\nUsing default value 20\n";
	}

	while(row <= stars)
	{
		column = 1;
		while(column <= stars)
		{
			if(row == 1 || row == stars)
			{
				cout << "*";
				column++;
			}
			else
			{
				cout << "*";
				for(int i = 1; i < stars - 1; i++)
				{
					cout << " ";
				}
				cout << "*";
				column = stars + 1;//breaks out of inner while loop
			}
		}
		cout << endl;
		row++;
	}
	cin.get();
	cin.get();//Pauses code at end
	return 0;
}